package com.ruoyi.yljf.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.yljf.mapper.AnnotationMapper;
import com.ruoyi.yljf.domain.Annotation;
import com.ruoyi.yljf.service.IAnnotationService;

import javax.annotation.Resource;

/**
 * 电子书笔记Service业务层处理
 * 
 * @author metaee
 * @date 2025-04-28
 */
@Service
public class AnnotationServiceImpl extends ServiceImpl<AnnotationMapper, Annotation> implements IAnnotationService {
    @Resource
    private AnnotationMapper annotationMapper;
    
    /**
     * 查询电子书笔记列表
     * 
     * @param annotation 电子书笔记
     * @return 电子书笔记
     */
    @Override
    public List<Annotation> selectAnnotationList(Annotation annotation) {
    	LambdaQueryWrapper<Annotation> queryWrapper = Wrappers.lambdaQuery();
        if (StringUtils.isNotNull(annotation.getEbookId())) {
			queryWrapper.eq(Annotation::getEbookId, annotation.getEbookId());
		}
        if (StringUtils.isNotEmpty(annotation.getContent())) {
			queryWrapper.eq(Annotation::getContent, annotation.getContent());
		}
        if (StringUtils.isNotNull(annotation.getPageId())) {
			queryWrapper.eq(Annotation::getPageId, annotation.getPageId());
		}
        if (StringUtils.isNotNull(annotation.getRowId())) {
			queryWrapper.eq(Annotation::getRowId, annotation.getRowId());
		}
        return annotationMapper.selectList(queryWrapper);
    }
}
